<template>
    <div>favor</div>
    <div class="favor" ref="favorRef">
        <van-tabs ref="tabs" scrollspy sticky>
            <van-tab v-for="index in 10" :title="'选项 ' + index">
                <h3>内容 {{ index }}</h3>
            </van-tab>  
        </van-tabs>
    </div>

</template>

<script setup>
import useScroll from "@/hooks/useScroll";
import { ref } from "vue";

const favorRef = ref()
useScroll(favorRef)
// import { computed, onMounted, nextTick, ref, watch } from "vue";
// const tabs = ref(null);
// onMounted(() => {
//   nextTick(() => {
//     // 通过 ref 获取到 Tabs 实例并调用实例方法实现
//     console.log(tabs.value);
//     tabs.value.scrollTo(3);
//   });
// });
</script>

<style scoped>
.favor{
    height: 200px;
    overflow: auto;
}
h3{
    margin: 20px 0;
}
</style>
